package top.italks.safeandroid;

import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultCaller;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.ActivityResultRegistry;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import top.italks.safemodule.AndroidSafe;

public class MainActivity extends AppCompatActivity {
    public static String RESULTKEY = "result2";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        AndroidSafe.init(this);

        ActivityResultContract<Boolean, Boolean> activityResultContract = new ActivityResultContract() {
            @NonNull
            @Override
            public Intent createIntent(@NonNull Context context, Object input) {
                Intent intent = new Intent(MainActivity.this, start.class);
                intent.putExtra(start.RESULT_KEY, (Boolean) input);
                return intent;
            }

            @Override
            public Object parseResult(int resultCode, @Nullable Intent intent) {

                return null;
            }
        };

        ActivityResultCallback activityResultCallback = new ActivityResultCallback() {
            @Override
            public void onActivityResult(Object result) {

            }
        };
        ActivityResultLauncher launcher = registerForActivityResult(activityResultContract, activityResultCallback);
        launcher.launch(true);
    }
}